﻿// JavaScript Document
$(function(){
	$('#in').bind("blur focus keydown keypress keyup", function(){
		recount();
	});
 
});

function recount(){
	var maxlen=150;
	var current = maxlen-$('#in').val().length;
	$('#counter').html(current);

	if(current<1 || current>maxlen){
		$('#counter').css('color','#D40D12');
		$('input.sub_btn').attr('disabled','disabled');
	}
	else
		$('input.sub_btn').removeAttr('disabled');

	if(current<10)
		$('#counter').css('color','#D40D12');

	else if(current<20)
		$('#counter').css('color','#5C0002');

	else
		$('#counter').css('color','#cccccc');

}
